package com.Shuang.exam4;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;

//完成对ArrayList的重写
public class Test {
    public static void main(String[] args) {
        //用来测试MyArrayList重写的功能
        MyArrayList<String> names = new MyArrayList<>();

        //添加
        names.add("杨过");
        names.add("小龙女");
        names.add("郭靖");
        names.add("蓉儿");
        System.out.println(names);

        //删除
        System.out.println(names.remove(2));
        System.out.println(names);

        System.out.println(names.size());

        System.out.println(names.get(0));

//        names.forEach(new MyConsumer<String>() {
//            @Override
//            public void accept(String s) {
//                System.out.println(s);
//            }
//        });

        names.forEach(s -> System.out.println(s));

//        names.forEach(System.out::println);
    }
}
